<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>

<body>
  <script>
    var divingBoard = function (shorter, longer, k) {
      if (k === 0) return []
      //如果长短都一样，那就只有一种结果，k块长的，或者k块短的
      if (shorter === longer) return [k * longer]
      var res = []
      for (var i = 0; i < k; i++) {
        // 如果有 i 块长的，短的必然是 k-i 块
        res.push(i * longer + (k - i) * shorter)
      }
      return res
    }
    console.log(divingBoard(1, 2, 3))
  </script>
</body>

</html>